package com.lhl.wx.cp.handler;

import cn.hutool.json.JSONUtil;
import com.lhl.wx.cp.builder.TextBuilder;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.message.WxCpXmlMessage;
import me.chanjar.weixin.cp.bean.message.WxCpXmlOutMessage;

import java.util.Map;

/**
 * @author Binary Wang(https://github.com/binarywang)
 */
@Slf4j
public class ScanHandler extends AbstractHandler {
    @Override
    public WxCpXmlOutMessage handle(WxCpXmlMessage wxMessage, Map<String, Object> context, WxCpService cpService,
                                    WxSessionManager sessionManager) {
        log.debug("wxMessage=={}", JSONUtil.toJsonPrettyStr(wxMessage));
        super.send(wxMessage,context,AbstractHandler.SCAN);
        return new TextBuilder().build("Scan", wxMessage, cpService);
    }
}
